package com.easygem.front.mapper;

import com.easygem.common.model.front.ResourceInfo;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * @author 肖智
 * @version 1.0
 * @Description 客户数据访问层
 * @date 2024/12/24
 */
public interface CustomerMapper extends Mapper<ResourceInfo>, com.easygem.business.mapper.Mapper<ResourceInfo> {
    //查询客户集合
    List<ResourceInfo> selectCustomerList(ResourceInfo resourceInfo);

    //总记录数
    Long selectCustomerList_COUNT(ResourceInfo resourceInfo);

    //根据id查询客户
    ResourceInfo getCustomerById(Long resourceId);

    //根据id查询客户
    Integer editCustomerById(ResourceInfo resourceInfo);

    //添加客户标签
    Integer addCustomerLabel(@Param("resourceId") Long resourceId, @Param("labelId") Integer labelId);

    //根据id删除客户
    Integer deleteCustomerById(@Param("resourceIds") Long[] resourceIds, @Param("deleteTime") String deleteTime);

    //添加客户
    Integer addCustomer(ResourceInfo resourceInfo);

    //客户转移
    Integer clientShift(@Param("accountName") String accountName,@Param("resourceId") Long resourceId, @Param("userId") Long userId);

    //批量导出
    List<ResourceInfo> findAllByResourceId(ResourceInfo resourceInfo, List<Long> ids);

    //查询电话A是否存在
    Integer isExistPhoneA(@Param("accountName") String accountName, @Param("phoneA") String phoneA);

    //查询电话B是否存在
    Integer isExistPhoneB(@Param("accountName") String accountName, @Param("phoneB") String phoneB);

    //客户导入
    Integer importClient(@Param("resourceInfoList") List<ResourceInfo> resourceInfoList);

    //根据账号查询adminId
    Long getAdminIdByAccountName(@Param("accountName") String accountName);
    //根据userId查询账户名
    String getAccountNameByUserId(@Param("userId") Long userId);
}
